home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Risc World 3
/
Risc World 3.iso
/
SOFTWARE
/
ISSUE3
/
SCRIBBLE
/
Examples
/
hello
< prev
next >
Wrap
Text File
|
2002-09-04
|
2KB
|
67 lines
-- hello example in Lua
verse1 = {
[[When good king Arthur ruled the land]],
[[he was a goodly king.]],
[[He stole three pecks of barley rye]],
[[to make bag pudding.]]
}
verse2 = {
[[A bag pudding the king did make]],
[[and stuffed it full of plums,]],
[[and in it put great lumps of fat]],
[[as big as my two thumbs.]]
}
verse3 = {
[[The king and queen did eat thereof]],
[[and noblemen beside,]],
[[and what they could not eat that night]],
[[the queen next morning fried.]]
}
x = BEGIN(arg[1].."_pdf")
x.red = function (self)
return self:setcolor("both","rgb",1,0,0,0)
end -- function
x.green = function (self)
return self:setcolor("both","rgb",0,1,0,0)
end -- function
x.blue = function (self)
return self:setcolor("both","rgb",0,0,1,0)
end -- function
x.showlines = function (self,t)
self:show("")
for i = 1,getn(t) do
self:continue_text(t[i])
end -- for
end -- function
x:set_info("Creator","hello")
x:set_info("Author","GCW")
x:set_info("Title","Hello there")
x:begin_page(A4.width,A4.height)
icon = x:open_image_file("jpeg",arg[1].."_jpg","",0)
x:place_image(icon,80,700,1)
x:close_image(icon)
font = x:findfont("Times-Roman", "host", 0)
x:setfont(font, 14)
x:set_text_pos(80, 680)
x:red()
x:showlines(verse1)
x:green()
x:continue_text(" ")
x:showlines(verse2)
x:blue()
x:continue_text(" ")
x:showlines(verse3)
x:END()